package com.dingreading.cloud.admin.service.impl;

import com.dingreading.cloud.admin.entity.StoreFollowImg;
import com.dingreading.cloud.admin.entity.table.StoreFollowImgTableDef;
import com.dingreading.cloud.admin.mapper.StoreFollowImgMapper;
import com.dingreading.cloud.admin.service.StoreFollowImgService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务层实现。
 *
 * @author Administrator
 * @since 2024-11-19
 */
@Service
public class StoreFollowImgServiceImpl extends BaseServiceImpl<StoreFollowImgMapper, StoreFollowImg, StoreFollowImgTableDef> implements StoreFollowImgService {

    @Override
    protected StoreFollowImgTableDef getTable() {
        return StoreFollowImgTableDef.storeFollowImg;
    }

    @Override
    public void deleteByFileIdsNotIn(Long followId, List<Long> fileIds) {
        getMapper().deleteByCondition(table.followId.eq(followId).and(table.id.notIn(fileIds)));
    }

    @Override
    public List<StoreFollowImg> listByFollowIdIn(List<Long> followIds) {
        return getMapper().selectListByCondition(table.followId.in(followIds));
    }

    @Override
    public List<StoreFollowImg> listByFollowId(Long followId) {
        return getMapper().selectListByCondition(table.followId.eq(followId));
    }
}
